const express = require('express');
const bodyParser = require('body-parser');

const app = express();
app.use(bodyParser.urlencoded({ extended: false }));

// 模拟用户数据
const users = [
  {
    username: 'username',
    password: 'password'
  }
];

app.post('/login', (req, res) => {
  const { username, password } = req.body;

  // 验证用户名和密码
  const user = users.find(user => user.username === username && user.password === password);

  if (user) {
    res.send('登录成功');
  } else {
    res.send('用户名或密码错误');
  }
});

app.listen(3000, () => {
  console.log('服务器已启动，监听3000端口');
});
